import request from '@/config/axios'

export interface shortLinkLogVO {
  id: number
  name: string
  status: number
  createTime: Date
  domain: string
  type: number
}

export interface UpdateStatusReqVO {
  id: number
  status: number
}

// 创建客服链接配置
export const createShortLinkLog = async (data) => {
  return await request.post({
    url: '/promotion/short-link-log/create',
    data: data
  })
}

// 更新客服链接配置
export const updateShortLinkLog = async (data) => {
  return await request.put({
    url: '/promotion/short-link-log/update',
    data: data
  })
}

// 删除客服链接配置
export const deleteShortLinkLog = async (id) => {
  return request.get({
    url: '/promotion/short-link-log/delete?id=' + id,
    method: 'delete'
  })
}

// 获得客服链接配置
export const getShortLinkLog = async (id) => {
  return request.get({
    url: '/promotion/short-link-log/get?id=' + id,
    method: 'get'
  })
}

// 获得客服链接配置分页
export const getShortLinkLogPage = async (query) => {
  return request.get({
    url: '/promotion/short-link-log/page',
    method: 'get',
    params: query
  })
}

// 导出客服链接配置 Excel
export const exportShortLinkLogExcel = async (query) => {
  return request.download({
    url: '/promotion/short-link-log/export-excel',
    params: query
  })
}

// 关闭链接
export const closeShortLinkLog = async (id: number) => {
  return await request.put({ url: '/promotion/short-link-log/close?id=' + id })
}
